package com.laich.springcloud.security.handle;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.security.core.Authentication;
import org.springframework.security.web.authentication.logout.LogoutSuccessHandler;
import org.springframework.stereotype.Component;

import com.laich.springcloud.utils.ResultUtil;

import lombok.extern.slf4j.Slf4j;

/**
 * 权限认证失败process
 * @author laichunhua
 *
 */
@Slf4j
public class CustomLogoutSuccessHandler implements LogoutSuccessHandler{
	
    public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response,Authentication authentication) {
        response.setContentType("application/json;charset=UTF-8");
        Map map = new HashMap();
        map.put("code", "403");
        map.put("data","退出成功");
        response.setContentType("application/json");
        response.setStatus(HttpServletResponse.SC_OK);
        log.info("<<<<<退出成功>>>>>>");
        ResultUtil.writeJavaScript(response,map);
    }
}
